package com.hange.excel.common;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

/**
 * @author Mars
 * @date 2024/03/17
 * @description websocket 后端返回的数据格式
 * {
 *     createTime: 命令发送时间
 *     data:{} 修改的命令
 *     id: "7a"   websocket的id
 *     returnMessage: "success"
 *     status: "0"  0告诉前端需要根据data的命令修改  1无意义
 *     type: 0：连接成功，1：发送给当前连接的用户，2：发送信息给其他用户，3：发送选区位置信息，999：用户连接断开
 *     username: 用户名
 * }
 */
@Data
@AllArgsConstructor
public class ResponseDTO implements Serializable {

    private static final long serialVersionUID = -275582248840137389L;

    private Integer type;

    private String id;

    private String username;

    private String data;

    public static ResponseDTO success(String id,String username,String data) {
        return new ResponseDTO(1,id,username, data);
    }

    public static ResponseDTO update(String id,String username,String data) {
        return new ResponseDTO(2,id,username, data);
    }

    public static ResponseDTO mv(String id,String username,String data) {
        return new ResponseDTO(3,id,username, data);
    }

    public static ResponseDTO bulkUpdate(String id,String username,String data) {
        return new ResponseDTO(4,id,username ,data);
    }

}
